5dfae177dbec07dc50f622d1c235f2505858ed1c,ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/AddTagAction.java,TagMenu,TagMenu,#ImageGalleryController#,77
Before Change
super(getActionDisplayName());
// Get the current set of tag names.
DrawableTagsManager tagsManager = controller.getTagsManager();
List<TagName> tagNames = null;
try {
tagNames = tagsManager.getAllTagNames();
} catch (TskCoreException ex) {
Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
}
// Create a "Quick Tag" sub-menu.
Menu quickTagMenu = new Menu("Quick Tag");
getItems().add(quickTagMenu);
// Each tag name in the current set of tags gets its own menu item in
// the "Quick Tags" sub-menu. Selecting one of these menu items adds
// a tag with the associated tag name.
if (null != tagNames && !tagNames.isEmpty()) {
for (final TagName tagName : tagNames) {
if (CategoryManager.isNotCategoryTagName(tagName)) {
MenuItem tagNameItem = new MenuItem(tagName.getDisplayName());
tagNameItem.setOnAction((ActionEvent t) -> {
addTag(tagName, NO_COMMENT);
After Change
/* Each non-Category tag name in the current set of tags gets its
* own menu item in the "Quick Tags" sub-menu. Selecting one of
* these menu items adds a tag with the associated tag name. */
Collection<TagName> tagNames = controller.getTagsManager().getNonCategoryTagNames();
if (tagNames.isEmpty()) {
MenuItem empty = new MenuItem("No tags");
empty.setDisable(true);
quickTagMenu.getItems().add(empty);